import 'package:flutter/material.dart';
import 'package:lib_uikit/lib_uikit.dart';


class GTFloatingViewV3 extends StatefulWidget {
  final String? imagePath;


  const GTFloatingViewV3(
      {super.key,
        this.imagePath,
      });

  @override
  State<StatefulWidget> createState() => _FloatingViewStateV3();
}

class _FloatingViewStateV3 extends State<GTFloatingViewV3> {
  double xPosition = 20;
  double yPosition = 20;

  @override
  Widget build(BuildContext context) {
    return Positioned(
      left: xPosition,
      top: yPosition,
      child: Draggable(
        child: FloatingActionButton(
          onPressed: () {

          },
          child: Icon(Icons.add),
          backgroundColor: Colors.blue,
        ),
        feedback: FloatingActionButton(
          onPressed: (){},
          child: Icon(Icons.add),
          backgroundColor: Colors.blue.withOpacity(0.5),
        ),
        onDragEnd: (details) {
          // 在拖拽结束时更新状态
          setState(() {
            xPosition += details.offset.dx;
            yPosition += details.offset.dy;
          });
        },
      ),
    );
  }
}

